<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
  Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
      "M+": this.getMonth() + 1, //月份
      "d+": this.getDate(), //日
      "h+": this.getHours(), //小时
      "m+": this.getMinutes(), //分
      "s+": this.getSeconds(), //秒
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
      "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
      if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
  }

  function setIdNo(){
    getBirthday('idNo','birthdayDate')
  }
  setIdNo();
  function report() {
    for (var i = 0; i < 3; i++) {
      document.getElementsByName('correctType')[i].disabled = true;
      document.getElementsByName('correctType')[i].checked = false;
    }
  }
  function report1() {
    for (var i = 0; i < 3; i++) {
      document.getElementsByName('correctType')[i].disabled = false;
    }
  }

  function infectionA() {
    for (var i = 0; i < 42; i++) {
      document.getElementsByName('bInfection')[i].checked = false;
    }
    for (var i = 0; i < 10; i++) {
      document.getElementsByName('cInfection')[i].checked = false;
    }
  }
  function infectionB() {
    for (var i = 0; i < 1; i++) {
      document.getElementsByName('aInfection')[i].checked = false;
    }
    for (var i = 0; i < 10; i++) {
      document.getElementsByName('cInfection')[i].checked = false;
    }
  }
  function infectionC() {
    for (var i = 0; i < 42; i++) {
      document.getElementsByName('bInfection')[i].checked = false;
    }
    for (var i = 0; i < 1; i++) {
      document.getElementsByName('aInfection')[i].checked = false;
    }
  }
  function print(id,clinicId,patientId){
    printPdf('${ctx}/doctor/placeInfectionRecord/print?id='+id+'&clinicId='+clinicId, 'patientId='+patientId);
  }
  function checkage(){
    var myDate = new Date();
    var date=new Date($("#birthdayDate").val().replace(/-/g, "/"));
    var aaInfection=$("input[name='aInfection']:checked").val();
    var bbInfection=$("input[name='bInfection']:checked").val();
    var ccInfection=$("input[name='cInfection']:checked").val();
    if((myDate.getFullYear()-date.getFullYear())*1<12 &&$("#genearchName").val().length<=0){
      toastr.info('患儿年龄太小，请填写患儿家长姓名！');
    }
    else if(aaInfection>='1'| bbInfection>='1'| ccInfection>='1'){
      $("#submit").attr("type","submit");

    }else{
      toastr.info('请选择一种传染病！');
    }
  }
</script>
<div>
  <form id="inputForm"   method="post" class="form-horizontal" onsubmit="return formSaveLoad('rigthDoctorCenterDiv','inputForm','${ctx}/doctor/placeInfectionRecord/save','${ctx}/doctor/placeInfectionRecord/index?clinicId=${clinicMaster.id}&patientId=${patMasterIndex.id}');">
    <input type="hidden" name="clinicId" value="${clinicMaster.id}" >
    <input type="hidden" name="patientId" value="${patMasterIndex.id}" >
    <input type="hidden" name="patMasterIndex.id" value="${patMasterIndex.id}" >
    <p align="center"><label><font size="4">中华人民共和国传染病报告卡</font></label></p>
    卡片编号：&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="radio" onclick="report()" name="reportType" value="1" data-parsley-required="true"/>初次报告
    <input type="radio" onclick="report1()"name="reportType" value="2" data-parsley-required="true"/>订正报告
    <sys:checkbox typeText="1" lists="${fns:getDictList('CORRECT_TYPE_DICT')}" name="correctType"></sys:checkbox>
    <div class="opertion_items">
      <div>基本信息</div>
    </div>
    <fieldset>
      <div class="form-group">
        <div class="col-lg-4">
          <label class="col-sm-5">患者姓名*：</label>
          <div class="col-sm-7">
            ${patMasterIndex.name}
            <input type="hidden" name="patMasterIndex.name" value="${patMasterIndex.name}" class="form-control">
          </div>
        </div>
        <div class="col-lg-4">
          <label class="col-sm-6">患儿家长姓名：</label>
          <div class="col-sm-6">
            <input type="text" id="genearchName" name="genearchName" class="form-control">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-4">
          <label class="col-sm-5">身份证号：</label>
          <div class="col-sm-7">
            <input type="text" name="patMasterIndex.idNo" onchange="setIdNo()" id="idNo" value="${patMasterIndex.idNo}" class="form-control">
          </div>
        </div>
        <div class="col-lg-6">
          <label class="col-sm-3">性别*：</label>
          <div class="col-sm-9">
            <c:forEach items="${fns:getDictList('SEX_DICT')}"  var="o">
              <input type="radio" data-parsley-required="true" name="sex"<c:if test="${o.value==patMasterIndex.sex}">checked="checked"</c:if> value="${o.value}"/>${o.label}
            </c:forEach>
          </div>
        </div>
        <div class="col-lg-2">
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-4">
          <label class="col-sm-5">出生日期*：</label>
          <div class="col-sm-7">
            <input type="text"  id="birthdayDate" name="patMasterIndex.birthdayDate" data-parsley-required="true"
                   value="<fmt:formatDate value="${patMasterIndex.birthdayDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
          </div>
        </div>
        <div class="col-lg-5">
          <p class="col-sm-9">如果真实年龄不详，实足年龄：</p>
          <div class="col-sm-3">
            <input type="number" name="realityAge" class="form-control">
          </div>
        </div>
        <div class="col-lg-3">
          年龄单位：
            <c:forEach items="${fns:getDictList('AGE_UNIT_DICT')}"  var="o">
              <input type="radio" name="ageUnit" value="${o.value}"/>${o.label}
            </c:forEach>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-8">
          <label class="col-sm-5">工作单位或学校或托幼机构*：</label>
          <div class="col-sm-7">
            <input type="text" name="workUnit" data-parsley-required="true" class="form-control">
          </div>
        </div>
        <div class="col-lg-4">
          <label class="col-sm-5">联系电话：</label>
          <div class="col-sm-7">
            <input type="text" data-parsley-mobilephone="ture" name="phone" class="form-control">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">病人属于*：</label>
          <div class="col-sm-10">
            <c:forEach items="${fns:getDictList('AREA_DICT')}"  var="o">
              <input type="radio" data-parsley-required="true" name="patientArea" value="${o.value}"/>${o.label}
            </c:forEach>
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">现住地址*：</label>
          <div class="col-sm-10">
            <input type="text" name="patMasterIndex.address" data-parsley-required="true" value="${patMasterIndex.address}" class="form-control">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">患者职业*：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <table border="0" width="100%">
              <c:forEach varStatus="i" begin="1" end="3">
                <tr align="left">
                  <c:forEach items="${fns:getDictList('INFECTION_IDENTITY_DICT')}" var="o" begin="${(i.index-1)*6}" end="${(i.index-1)*6+5}">
                    <td width="16.6%">
                      <input type="radio" name="infectionIdentity" data-parsley-required="true"  value="${o.value}"/>${o.label}
                    </td>
                  </c:forEach>
                </tr>
              </c:forEach>
            </table>
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">病例分类*：</label>
          <div class="col-sm-10">
            （1）<c:forEach items="${fns:getDictList('CASE_TYPE_DICT')}"  var="o">
                  <input type="radio" data-parsley-required="true" name="caseType" value="${o.value}"/>${o.label}
                </c:forEach>
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2"></label>
          <div class="col-sm-3">
            （2）<c:forEach items="${fns:getDictList('SPEED_TYPE_DICT')}"  var="o">
                  <input type="radio" data-parsley-required="true" name="speedType" value="${o.value}"/>${o.label}
                </c:forEach>
          </div>
          <label class="col-sm-7">(乙肝类型、丙肝类型、血吸虫病填写）</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">发病日期*：</label>
          <div class="col-sm-2">
            <input type="text" name="illnessDate" data-parsley-required="true"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
          </div>
          <label class="col-sm-8">（病原携带者填初检日期或就诊日期）</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">诊断日期*：</label>
          <div class="col-sm-2">
            <input type="text" name="diagnoseDate" data-parsley-required="true"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">死亡日期：</label>
          <div class="col-sm-2">
            <input type="text" name="deathDate"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">甲类传染病*：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <c:forEach items="${fns:getDictList('A_INFECTION_DICT')}"  var="o">
              <input type="radio" onclick="infectionA()" name="aInfection" value="${o.value}"/>${o.label}
            </c:forEach>
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">乙类传染病*：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <table border="0" width="100%">
              <c:forEach varStatus="i" begin="1" end="7">
                <tr align="left">
                  <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="${(i.index-1)*5}" end="${(i.index-1)*5+4}">
                    <td width="20%">
                      <input type="radio" onclick="infectionB()" name="bInfection" value="${o.value}"/>${o.label}
                    </td>
                  </c:forEach>
                </tr>
              </c:forEach>
              <tr align="left">
                <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="35" end="38">
                  <td width="20%">
                    <input type="radio" onclick="infectionB()" name="bInfection" value="${o.value}"/>${o.label}
                  </td>
                </c:forEach>
              </tr>
              <tr align="left">
                <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="39" end="42">
                  <td width="20%">
                    <input type="radio" onclick="infectionB()" name="bInfection" value="${o.value}"/>${o.label}
                  </td>
                </c:forEach>
              </tr>
            </table>
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-2">丙类传染病*：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <table border="0" width="100%">
              <c:forEach varStatus="i" begin="1" end="3">
                <tr align="left">
                  <c:forEach items="${fns:getDictList('C_INFECTION_DICT')}" var="o" begin="${(i.index-1)*4}" end="${(i.index-1)*4+3}">
                    <td width="25%">
                      <input type="radio" onclick="infectionC()"name="cInfection" value="${o.value}"/>${o.label}
                    </td>
                  </c:forEach>
                </tr>
              </c:forEach>
            </table>
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-12">其他法定管理已经检测传染病：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <textarea  name="otherInfection" rows="3" maxlength="200" class="form-control"/>
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-6">
          <label class="col-sm-4">订正前病名：</label>
          <div class="col-sm-8">
            <input type="text" name="updateBeforeName" class="form-control">
          </div>
        </div>
        <div class="col-lg-6">
          <label class="col-sm-4">退卡原因：</label>
          <div class="col-sm-8">
            <input type="text" name="returnReason" class="form-control">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-6">
          <label class="col-sm-4">报告单位*：</label>
          <div class="col-sm-8">
            <input type="text" name="reportUnit" data-parsley-required="true" class="form-control">
          </div>
        </div>
        <div class="col-lg-6">
          <label class="col-sm-4">联系电话：</label>
          <div class="col-sm-8">
            <input type="text" name="unitPhone" class="form-control">
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-6">
          <label class="col-sm-4">报告医生*：</label>
          <div class="col-sm-8">
            ${user.name}
            <input type="hidden" name="doctorName" data-parsley-required="true" class="form-control">
          </div>
        </div>
        <div class="col-lg-6">
          <label class="col-sm-4">填卡日期*：</label>
          <div class="col-sm-8">
            <input type="text" name="writeDate" data-parsley-required="true"
                   value="<fmt:formatDate value="${writeDate}" pattern="yyyy-MM-dd" type="date" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate"/>
          </div>
        </div>
      </div>
      <hr/>
      <div class="form-group">
        <div class="col-lg-12">
          <label class="col-sm-12">备注*：</label>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-12">
          <div class="col-sm-12">
            <textarea  name="remarks" rows="3" data-parsley-required="true" maxlength="200" class="form-control"/>
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-lg-4">
        </div>
        <div class="col-lg-4">
          <button type="button" onclick="checkage()" id="submit" class="btn btn-primary">保存</button>
          <button onclick="print('','${clinicMaster.id}','${patMasterIndex.id}')" type="button" class="btn btn-primary">打印</button>
        </div>
      </div>
    </fieldset>
  </form>
</div>